<!--conf
<sample>
              <product version="2.0" edition="pro"/>
                     <modifications>
                            <modified date="070101"/>
                     </modifications>
               </sample>
 --> 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
	<title>Context menu</title>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<link rel="stylesheet" type="text/css" href="../../../codebase/dhtmlx.css"/>
	<script src="../../../codebase/dhtmlx.js"></script>
</head>

<body onResize="return true;" >
	
	<h1>Context menu</h1>
    <p>There is an opportunity which allows you to set color for any row in the grid. Click right button on any row and select proper color in the context menu.</p>
	<table width="100%">
		<tr>
			<td>
				<div id="gridbox" style="width:100%;height:270px;background-color:white;"></div>
			</td>
    	</tr>
	</table>

<br>
<br>

<script>
	function onButtonClick(menuitemId,type){
                var data = mygrid.contextID.split("_"); //rowId_colInd
                mygrid.setRowTextStyle(data[0],"color:"+menuitemId.split("_")[1]);
				return true
	}

	menu = new dhtmlXMenuObject();
	menu.setIconsPath("../common/images/");
	menu.renderAsContextMenu();
	menu.attachEvent("onClick",onButtonClick);
	menu.loadStruct("../common/_context.xml");

	mygrid = new dhtmlXGridObject('gridbox');
	mygrid.setImagePath("../../../codebase/imgs/");
	mygrid.setHeader("Author,Title");
	mygrid.setInitWidths("250,250");
	mygrid.enableAutoWidth(true);
	mygrid.setColAlign("left,left");
	mygrid.setColTypes("ro,link");
	mygrid.setColSorting("str,str");
    mygrid.enableContextMenu(menu);
    mygrid.init();
	mygrid.setSkin("dhx_skyblue")
	mygrid.loadXML("../common/grid_links.xml");
</script>

</body>
</html>
